Skip to content

fix: add address encoding validation in TokenLib.finalizeTransfer#192

Open
Arvuno wants to merge 1 commit into
base:mainfrom
Arvuno:new/tokenlib
Open

fix: add address encoding validation in TokenLib.finalizeTransfer#192
Arvuno wants to merge 1 commit into
base:mainfrom
Arvuno:new/tokenlib

Conversation

@Arvuno
Copy link
Copy Markdown

@Arvuno Arvuno commented May 31, 2026

Add validation function to detect wrong (right-aligned) address encoding in TokenLib.finalizeTransfer and prevent silent misuse. Detects bytes32(uint256(uint160(addr))) vs correct bytes32(bytes20(addr)).

Add _validateAddressEncoding() function that detects when a caller uses
wrong (right-aligned) address encoding (bytes32(uint256(uint160(addr))))
instead of the correct left-aligned form (bytes32(bytes20(addr))).

The validation is called at the start of finalizeTransfer() and uses a
require statement with a clear error message (WrongAddressEncoding).

This prevents silent mis-use where the address would be decoded incorrectly.

Closes base#190
@cb-heimdall
Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants